#include "shop.h"

void find_price(int task_id, int N, int K, int ans[]) {
	// There will be T times call to the function, be sure to clear data before doing anything else.
	for (int i = 0; i < N; ++i) ans[i] = 0; 	

	if (K == 0) { 			// K = 0 implies there will be even number of `1`.
		// Assume ans[0] = ans[1] = 1
		ans[0] = ans[1] = 1;
	} else {			// K = 1 implies there will be odd number of `1`.
		// Assume either ans[0] = 1 or ans[1] = 1, following procedure can check which one is true.
		int arr[5], brr[5];
		arr[0] = 0;
		brr[0] = 1;
		if (query(arr, 1, brr, 1) == 0) {
			ans[0] = 1;
		} else {
			ans[1] = 1;
		}
	}
}
